<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" />
    <HelloWorld :msg="msg" @patch="onPatch">
      <h1 slot="m">插槽</h1>
    </HelloWorld>
    <router-view></router-view>
    <router-link to="/home">首页</router-link>
    <router-link to="/login">登录</router-link>
  </div>
</template>
// dispatch => actions => commit => mutation => state => view
<script>
import HelloWorld from "./components/HelloWorld.vue";

export default {
  name: "App",
  data: function() {
    return {
      msg: "fuck"
    };
  },
  components: {
    HelloWorld
  },
  mounted() {
    console.log("mounted");
    this.test();
  },
  methods: {
    onPatch: function() {
      console.log("onPatch");
    },
    test() {
      console.log("call test");
      this.msg = "fuck you";
    }
  }
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
